#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1010;
const int S = 1 << 15;
const int mod = 1e9+7;

int U,f[2][S][3],dp[2][20],n,m,ans[20],nxt[3][3] = {{1,0,0},{1,2,0},{1,0,3}},to[S][3];
char T[20];

int popcnt(int x){int res=0;for(;x;x>>=1)res+=x&1;return res;}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in; scanf("%s",T+1); for(int i = 1;i <= m;i++) T[i] = T[i] == 'N' ? 0 : T[i] == 'O' ? 1 : 2;
    U = 1 << m;
	for(int s = 0;s < U;s++){
		for(int j = 0;j < m;j++) dp[0][j+1] = dp[0][j] + (s >> j & 1);
		for(int k = 0;k <= 2;k++){
			for(int j = 1;j <= m;j++) dp[1][j] = max(dp[0][j],max(dp[0][j-1] + (k == T[j]),dp[1][j-1]));
			int newst = 0;
			for(int j = 1;j <= m;j++) if(dp[1][j] > dp[1][j-1]) newst |= 1 << j-1;
			to[s][k] = newst;
		}
	}
	f[0][0][0] = 1; int o = 0;
	for(int i = 1;i <= n;i++,o ^= 1){
		memset(f[o^1],0,sizeof(f[o^1]));
		for(int s = 0;s < U;s++){
			for(int j = 0;j <= 2;j++)
				for(int k = 0;k <= 2;k++){
					if(j == 2 && k == 2) continue;
					(f[o^1][to[s][k]][nxt[j][k]] += f[o][s][j]) %= mod;
				}
		}
	}
	for(int s = 0;s < U;s++) for(int j = 0;j <= 2;j++) (ans[popcnt(s)] += f[o][s][j]) %= mod;
	for(int i = 0;i <= m;i++) printf("%d\n",ans[i]);
	return 0;
}

